<template>
	<view >
		<uni-nav-bar title="医疗信息化救治平台" />
    <image src="../../static/icons/user.png" style="width: 48rpx;height: 48rpx; float: left;"></image>
	<view class="loginInfo">
		<view style="margin-top: 10rpx;" @click="user">
			<text >个人信息</text>
		</view>
	</view>
	<uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="info" :current="current" :mode="mode"
		:dots-styles="dotsStyles" field="content">
		<swiper class="swiper-box" @change="change" :current="swiperDotIndex">
			<swiper-item v-for="(item, index) in 3" :key="index">
				<view class="swiper-item" :class="'swiper-item' + index">
					<text style="color: #fff; font-size: 32px;"></text>
				</view>
			</swiper-item>
		</swiper>
	</uni-swiper-dot>
	<!-- <view class="">
		<image src="../../static/R-C.jpg" style="width: 80%;margin-left: 10%;"></image>
	</view> -->

		<view class="card-group">
			<view class="card-box-item" v-for="(item,index) in filtersMenuList()" :key="index">
				<view class="content" v-for="(key,val) in item" @tap="goCurrentPage(key.to)">
					<image :src="key.img" style="width: 50rpx;" mode="widthFix"></image>
					<text>{{key.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		log
	} from '../../common/util.js'
	import {
		toast,
		signOut,
		getStorageSync,
		useRouter
	} from '../../utils/utils.js'


	export default {

		data() {
			return {
				info: [{
						colorClass: 'uni-bg-red',
						url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
						content: '内容 A'
					},
					{
						colorClass: 'uni-bg-green',
						url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
						content: '内容 B'
					},
					{
						colorClass: 'uni-bg-blue',
						url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
						content: '内容 C'
					}
				],
				token: getStorageSync('token') || null,
				offlineMenuList: [[
					{
						name: '伤员登记',
						to: '/pages/offlineWounded/indexv4',
						img: '../../static/icons/dengji.png'
					},
					{
						name: '伤员列表',
						to: '/pages/offlineCasualtyList/indexv4',
						img: '../../static/icons/list.png'
					}]
				],
				menuList: [
					[{
							name: '新增患者',
							to: '/pages/wounded/indexv4',
							img: '../../static/icons/hz.png'
						},
						{
							name: '查看患者',
							to: '/pages/casualtyList/indexv4',
							img: '../../static/icons/ck.png'
						},
						{
							name: '后送管理',
							to: '/pages/evacuation/indexv4',
							img: '../../static/icons/hs.png'
						},
						
					],
					[
						{
							name: '组物质申请',
							to: '/pages/goodsManager/collarGoods',
							img: '../../static/icons/wz.png'
						},
						{
							name: '后送记录',
							to: '/pages/evacuationRecording/indexv4',
							img: '../../static/icons/jl.png'
						},
						{
							name: '组物资申请记录',
							to: '/pages/goodsManager/indexv4',
							img: '../../static/icons/zj.png'
						}
					],
					// [
					// 	{
					// 		name: '后送记录',
					// 		to: '/pages/evacuationRecording/index',
					// 		img: '../../static/icons/Recording.png'
					// 	},
					// 	{
						
					// 		name: '护理记录',
					// 		to: '/pages/nursing/index',
					// 		img: '../../static/icons/nursing.png'
					// 	},
					// ]
					// {
					// 	name: '患者流转',
					// 	to: '',
					// 	img: '../../static/icons/change.png'
					// }
				]
			}
		},

		onLoad() {
			if (typeof(this.token) === 'boolean') {
				uni.setTabBarItem({
					index: 1,
					visible: false
				})

			} else {
				uni.setTabBarItem({
					index: 1,
					visible: true
				})
			}

		},
		onTabItemTap() {
			const token = getStorageSync('token') || null


			if (!token) {
				signOut()
				toast('请先登录后在使用!')
			}
		},
		methods: {
			user(){
				uni.navigateTo({
					url:'../my/indexv4'
				})
			},
			goCurrentPage(to){
				useRouter(to,{},'navigateTo')
			},
			//根据登录状态，展示不同的按钮
			filtersMenuList() {
				if (typeof(this.token) === 'string') {
					// 账号密码登录状态
					return this.menuList

				} else {
					// 离线登录状态
					return  this.offlineMenuList
				}
			}


		}
	}
</script>


<style lang="scss">
	.swiper-box {
			height: 200px;
		}
	
		.swiper-item {
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			flex-direction: column;
			justify-content: center;
			align-items: center;
			height: 200px;
			color: #fff;
		}
	
		.swiper-item0 {
			background-color: #cee1fd;
			background-image: url('../../static/R-C.jpg');
			background-size: 100%;
		}
	
		.swiper-item1 {
			background-color: #b2cef7;
			background-image: url('../../static/lun2.jpg');
			background-size: 100%;
		}
	
		.swiper-item2 {
			background-color: #cee1fd;
			background-image: url('../../static/lun3.jpg');
			background-size: 100%;
		}
	
		.image {
			width: 750rpx;
		}
	
		/* #ifndef APP-NVUE */
		::v-deep .image img {
			-webkit-user-drag: none;
			-khtml-user-drag: none;
			-moz-user-drag: none;
			-o-user-drag: none;
			user-drag: none;
		}
	
		/* #endif */
	
		@media screen and (min-width: 500px) {
			.uni-swiper-dot-box {
				width: 400px;
				margin: 0 auto;
				margin-top: 8px;
			}
	
			.image {
				width: 100%;
			}
		}
	
		.uni-bg-red {
			background-color: #ff5a5f;
		}
	
		.uni-bg-green {
			background-color: #058603;
		}
	
		.uni-bg-blue {
			background-color: #007aff;
		}
	
		.example-body {
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			flex-direction: row;
			padding: 20rpx;
		}
	
		.example-body-item {
	
			flex-direction: row;
			justify-content: center;
			align-items: center;
			margin: 15rpx;
			padding: 15rpx;
			height: 60rpx;
			/* #ifndef APP-NVUE */
			display: flex;
			padding: 0 15rpx;
			/* #endif */
			flex: 1;
			border-color: #e5e5e5;
			border-style: solid;
			border-width: 1px;
			border-radius: 5px;
		}
	
		.example-body-item-text {
			font-size: 28rpx;
			color: #333;
		}
	
		.example-body-dots {
			width: 16rpx;
			height: 16rpx;
			border-radius: 50px;
			background-color: #333333;
			margin-left: 10rpx;
		}
	
		.active {
			border-style: solid;
			border-color: #007aff;
			border-width: 1px;
		}
	.card-group {
		margin: 32rpx;
	
		.card-box-item {
			height: 220rpx;
			width: 100%;
			background-color: #8c8c00;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-around;
			margin-bottom: 20rpx;
			color: #fff;
	
			.content {
				text-align: center;
	
				&>text {
					display: block;
					font-size: 32rpx;
				}
			}
		}
	}
	.notice-bar {
		width: 100%;
		height: 100%;
	}
	.loginInfo{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 20rpx 30rpx;
		font-size: 24rpx;
		color: #666;
	}
</style>